/**
 * Created by eva on 2020/1/2.
 */
document.body.onload  = init;
var can,ctx;
var w,h;
var girlPic = new Image();
function init(){
    can = document.getElementById("canvas");
    ctx = can.getContext("2d");

    w = can.width;
    h = can.height;

    girlPic.src = "./src/girl.jpg";
    gameloop();

}
function gameloop() {
    window.requestAnimFrame(gameloop);
    drawBackground();
    drawGirl();
    drawStar();


}
function drawBackground(){
    ctx.fillStyle = "#393550";
    ctx.fillRect(0,0,w,h);
}
function drawGirl() {
    //drawImage(img,x,y);
    //x  向右 y 向下
    ctx.drawImage(girlPic,0,0,600,300);
}